package com.giraffe.common.core.enums;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @Author ldx
 * @Date 2023/02/06 15:07
 **/
public enum DelFlagStatusEnum {

  /**
   * DELETE
   */
  DELETE("003","删除"),

  /**
   * NORMAL
   */
  NORMAL("009","正常");

  @JsonValue
  private String code;

  private String des;

  DelFlagStatusEnum(String code, String des) {
    this.code = code;
    this.des = des;
  }

  public String getCode() {
    return code;
  }

  public String getDes() {
    return des;
  }

  /**
   * 根据code转枚举
   * @param code
   * @return
   */
  public static DelFlagStatusEnum codeToEnum(String code) {
    DelFlagStatusEnum delFlagStatus = null;
    for (DelFlagStatusEnum enableStatusEnum : DelFlagStatusEnum.values()) {
      if (enableStatusEnum.code.equals(code)) {
        delFlagStatus = enableStatusEnum;
      }
    }
    return delFlagStatus;
  }
}
